<?php

namespace api\privacy;

use app\Api;
use app\lib\ApiClient;
use app\lib\ApiClientException;


class App extends Api
{
    public function query()
    {
        $value = input('get.value', null, 'trim');

        //基本配置
        try {
            $client = new ApiClient();
            $client->addDefaultHeader('Referer', 'https://detail.aiuys.com/');
            $res = $client->get('https://detail.aiuys.com/api/query', [
                'value' => $value,
            ]);
            if ($res['code'] != 200) return msg(401, '获取失败');
            return json($res['data']);
        } catch (ApiClientException $e) {
            return msg(500, '获取失败');
        }
    }
}
